import 'package:flutter/material.dart';

class NewsPage2 extends StatefulWidget {
  @override
  _NewsPage2State createState() => _NewsPage2State(this.arguments);

  Map arguments;

  NewsPage2({this.arguments});
}

class _NewsPage2State extends State<NewsPage2> {
//  _NewsPageState();
  var args;
  String _title;
  String _content;

  _NewsPage2State(argument) {
    this.args = argument;
    if (args != null) {
      _title = args['title'];
      _content = args['content'];
    }
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text('news list demo'),
      ),
      body: (this._title == null && this._content == null)
          ? Text('没有数据')
          : Container(
              padding: EdgeInsets.all(10.0),
              child: Column(
                children: <Widget>[
                  Text(
                    this._title,
                    style: TextStyle(fontSize: 20),
                  ),
                  Divider(),
                  Text(
                    this._content,
                    style: TextStyle(fontSize: 20),
                  )
                ],
              ),
            ),
    );
  }

  @override
  void initState() {
//    _getData();
  }

  void _getData() async {}

  void initParam() {
    if (this.args != null) {
      this._title = this.args['title'];
      this._content = this.args['content'];
    }
    print('build');
    print(args);
    print('build end');
  }
}
